Skip to content

Refs #4412: using namespace std; not simplified (constructor)#8477

Open
chrchr-github wants to merge 5 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_4412
Open

Refs #4412: using namespace std; not simplified (constructor)#8477
chrchr-github wants to merge 5 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_4412

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github chrchr-github marked this pull request as ready for review April 22, 2026 09:22
@chrchr-github chrchr-github marked this pull request as draft April 22, 2026 09:26
@sonarqubecloud
Copy link
Copy Markdown

@chrchr-github chrchr-github marked this pull request as ready for review April 22, 2026 11:05
Comment thread test/testtokenize.cpp
}

{
const char code[] = "using namespace std;\n"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is a realistic test case. I get this with g++ for such code:

$ g++ -fsyntax-only 1.cpp
1.cpp:8:1: error: reference to ‘string’ is ambiguous
    8 | string foo() {
      | ^~~~~~
In file included from /usr/include/c++/15/string:43,
                 from 1.cpp:2:
/usr/include/c++/15/bits/stringfwd.h:79:33: note: candidates are: ‘typedef class std::__cxx11::basic_string<char> std::string’
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
1.cpp:6:6: note:                 ‘void string()’
    6 | void string();
      |      ^~~~~~

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll switch the order of declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants